#include<stdio.h>
#include<string.h>

/*一个字符串，并将该字符串中的空格去除后输出 并统计去掉空格之后的长度*/

int main()
{
    char buffer[] = "l am  student";
    
    int pos = 0;
    int length = strlen(buffer);
    for (int idx = 0;idx < length; idx++)
    {
        if (buffer[idx] == ' ')
        {

        }
        else
        {
         buffer[pos] = buffer[idx];
         pos++;
        }
 }
  printf("pos = %d\n",pos);
  /*加上字符串结束符*/
  buffer[pos] = '\0';
  printf("buffer = %s\n",buffer);
    return 0;
}
